<!DOCTYPE html>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<svg>
  <linearGradient id="g1">
    <stop stop-color="red"/>
  </linearGradient>
  <rect width="100" height="100" fill="url(#g1) green"/>
</svg>
<script>
runAfterLayoutAndPaint(function() {
  document.body.style.display = "flex";
  document.documentElement.offsetTop;

  document.getElementById("g1").remove();
  document.documentElement.offsetTop;
}, true);
</script>
